{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete the news item. Continue?"))
document.location = "admin.php?page=news&action=delete&id=" + articleId;
}

function confirmPublish(articleId)
{
    if (confirm("This will publish the news item. Continue?")){/literal}
    document.location = "{$pagename}&action=publish&id=" + articleId;{literal}
}

function confirmunPublish(articleId)
{
    if (confirm("This will unpublish the news item. Continue?")){/literal}
    document.location = "{$pagename}&action=unpublish&id=" + articleId;{literal}
}
//-->
</script>
{/literal}
{if $action != "edit" && $action != "new"}
{if $numnews > 0}
<h2>News Items</h2>
<div align="left"><input type="button" class="button" value="Add News Item" onclick="window.location='{$pagename}&amp;action=new'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th width="10%" class="smallhead">Published</th>
    <th width="20%" class="smallhead">Title</th>
    <th width="45%" class="smallhead">News Summary</th>
    <th width="15%" class="smallhead">Date/Time</th>
    <th class="smallhead">Owner</th>
  </tr>
 {section name=newsloop loop=$numnews}
	  <tr valign="middle"> 
		<td class="text"><a href="{$pagename}&amp;id={$news[newsloop].id}&amp;action=edit"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$news[newsloop].event}" title="Edit {$news[newsloop].event}" /></a> - <a href="javascript:confirmDelete({$news[newsloop].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$news[newsloop].event}" title="Delete {$news[newsloop].event}" /></a></td>
        <td class="text">{if $news[newsloop].allowed == 0}<a href="javascript:confirmPublish({$news[newsloop].id})"><img src="{$tempdir}admin/images/publish.png" border="0" alt="Publish {$news[newsloop].event}" title="Publish {$news[newsloop].event}" /></a>{else}<a href="javascript:confirmunPublish({$news[newsloop].id})"><img src="{$tempdir}admin/images/unpublish.png" border="0" alt="Unpublish {$news[newsloop].event}" title="Unpublish {$news[newsloop].event}" /></a>{/if}</td>
		<td class="text">{$news[newsloop].title}</td>
		<td class="text">{$news[newsloop].news|strip_tags|truncate:80}</td>
		<td class="text">{$news[newsloop].event+$timeoffset|date_format:"%B %e, %Y %H:%M"}</td>
		<td class="text">{$news[newsloop].owner}</td>
	  </tr>  
	{/section}
</table>
{else}
<div align="center">No news items</div>
{/if}
<div align="left"><input type="button" class="button" value="Add News Item" onclick="window.location='{$pagename}&amp;action=new'" /></div>
{else}
<form name="News" method="post" action="{$editFormAction}">

<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
    <tr> 
      <th colspan="2" class="bighead"> 
        <div align="center">News Item</div>
      </th>
    </tr> 
    <tr>
        <td class="text"><div align="right">
            Title:</div>
        </td>
        <td class="text"><div align="left">
         <input type="text" name="title" id="title" size="100" value="{$shownews.title}" class="inputbox"/></div>
        </td>
    </tr>
    <tr valign="middle"> 
      <td width="11%" class="text" valign="top"><div align="right">News Item:</div></td>
      <td width="89%" class="text"> <div align="center">
                  <textarea id="editor" name="editor" style="width:100%; height:50em" class="inputbox">{$shownews.news}</textarea>
</div>
	  </td>
    </tr>
    <tr valign="middle"> 
      <td colspan="2" class="text"> 
        <div align="center"> 
          	{if ($action!="edit")}
			  	<input type="submit" name="Submit" value="Add" class="button" />
			{else}
			  	<input type="submit" name="Submit" value="Modify" class="button" />
			{/if}  
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="window.location = '{$pagename}'" class="button" />
	</div>
      </td>
    </tr>
  </table>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-news" target="_blank">Help</a>
</div>
